﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace iLangl.Tests.AlertsFixture
{
	[TestClass]
	public class AlertSeverityFixture : BaseTest
	{
		[TestMethod]
		public void AlertSeverity()
		{
			IAlert alert = Facade.Instance.AlertManager.CreateAlert(this);

			Assert.AreEqual(alert.Severity, eSeverity.Unknown);

			alert.AddError( new Error("", "", eSeverity.Unknown));
			Assert.AreEqual(alert.Severity, eSeverity.Unknown);

			alert.AddError(new Error("", "", eSeverity.Low));
			Assert.AreEqual(alert.Severity, eSeverity.Low);

			alert.AddError(new Error("", "", eSeverity.Medium));
			Assert.AreEqual(alert.Severity, eSeverity.Medium);

			alert.AddError(new Error("", "", eSeverity.High));
			Assert.AreEqual(alert.Severity, eSeverity.High);

			alert.AddError(new Error("", "", eSeverity.Critical));
			Assert.AreEqual(alert.Severity, eSeverity.Critical);

			alert = Facade.Instance.AlertManager.CreateAlert(this);
			Assert.AreEqual(alert.Severity, eSeverity.Unknown);

			alert.AddError(new Error("", "", eSeverity.Low));
			Assert.AreEqual(alert.Severity, eSeverity.Low);

			alert.AddException(new Exception());
			Assert.AreEqual(alert.Severity, eSeverity.High);

		}
	}
}
